 Ext.onReady(function() {
		var formg = Ext.create("Ext.form.Panel", {
			minHeight:100,
		    title: "查询条件",
		    collapsible: true,  //可折叠
		    autoScroll: false,   //自动创建滚动条
		    defaultType: 'textfield',
		    defaults: {
		    	 anchor: '100%'
		    },
		    fieldDefaults: {
		        margin: 2
		    },
		    items: [{
		            xtype: "container",
		            layout: "hbox",
		            items: [
//		                    { xtype: "textfield", name:"roomName", fieldLabel: "项目名称"},
			                { xtype: "textfield", name:"userName", fieldLabel: "客户名称"},
			                { xtype: "datefield", name: "createTimeBefore",fieldLabel: "反馈开始时间",format:'Y-m-d'},
			                { xtype: "datefield", name: "createTimeAfter", fieldLabel: "反馈结束时间",format:'Y-m-d'}
		            ]
		        }
		        ],
		    buttons: [
				  	        { xtype: "button", text: "查询", 
				  	        	handler:function(){
				  	        		gridStoreg.load();
				  	        		var pagingTool=Ext.getCmp("pagingToolg");
				  	        		pagingTool.moveFirst();//跳至第一页
				  	        	}  
				  	        },
				  	        { xtype: "button", text: "清空",handler:function(){
				  	        		formg.getForm().reset();
				  	        	}
				  	        }
				  	    ]    
	});
	
	var gridStoreg = Ext.create('Ext.data.Store', {
        fields: ["id","projectName","userName", "problemContent","createTime"],
        pageSize: 10,  //页容量5条数据
        //是否在服务端排序 （true的话，在客户端就不能排序）
        remoteSort: false,
        proxy: {
            type: 'ajax',
            url: jypath+'/system/problemFeedback/list',
            actionMethods: { read: 'POST' },
            reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
                type: 'json', //返回数据类型为json格式
                root: 'rows',  //数据
                totalProperty: 'total' //数据总条数
            }
        },
        autoLoad: true  //即时加载数据
    });
	
	gridStoreg.on("beforeload",function(){
        Ext.apply(gridStoreg.proxy.extraParams,formg.getForm().getValues());
    });
	
	function onreload(){
		gridStoreg.on("beforeload",function(){
	        Ext.apply(gridStoreg.proxy.extraParams,formg.getForm().getValues());
	    });
	}
	
	var gridg = Ext.create('Ext.grid.Panel', {
		minHeight:600,
		renderTo: document.body,
        store: gridStoreg,
        columnLines: true,
        columns: [
        {
            text     : '项目名称', 
            dataIndex: 'projectName',
            width:200
        },{
            text     : '客户名称',
            dataIndex: 'userName'
        },{
            text     : '反馈内容',
            dataIndex: 'problemContent',
            width:700
        },{
            text: '反馈时间',
            dataIndex: 'createTime',
            width:200,
            renderer:function(value){
            	return Ext.Date.format(new Date(value),'Y-m-d H:i:s')
            }
        }],
        title: '反馈列表',
        dockedItems: [{  
            xtype: 'pagingtoolbar',  
            store: gridStoreg,   // GridPanel中使用的数据  
            dock: 'bottom',  
            displayInfo: true,  
            emptyMsg:"没有数据",  
            displayMsg:"显示从{0}条数据到{1}条数据，共{2}条数据",
            id:'pagingToolg'
        }
        ]
    });
	
	var viewport = Ext.create('Ext.Viewport', {
		layout : 'border',
		items:[
		  {   
			  region:'north',
			  items:formg
		  },{
			  region:'center',
			  items:gridg 
		  }    
		]
	});	
		
});
